var IP = "192.168.105.79";
var ws20 = new WebSocket("ws://"+IP+":1882/ws/OP20");
ws20.onmessage = function(e) {

var obj = JSON.parse(e.data);

robot.joints.j2.position.y = obj[0];
robot.joints.j3.position.z = obj[1];
robot.joints.j_scara_1.rotation.z = obj[2];
robot.joints.j_scara_2.rotation.z = obj[3];
robot.joints.j_scara_3.rotation.z = obj[4];

};

var ws10 = new WebSocket("ws://"+IP+":1882/ws/OP10");
ws10.onmessage = function(e) {

var obj = JSON.parse(e.data);
robot.joints.j_roller.rotation.z = obj[0];

};

var ws30 = new WebSocket("ws://"+IP+":1882/ws/OP30");
ws30.onmessage = function(e) {

var obj = JSON.parse(e.data);
robot.joints.j_transfer_x.position.x = obj[0] + 0.2;
robot.joints.l_transfer_y.position.y = obj[1] + 0.73;
robot.joints.z_transfer_z.position.y = obj[2] - 0.02;

};

var ws40 = new WebSocket("ws://"+IP+":1882/ws/OP40");
ws40.onmessage = function(e) {

var obj = JSON.parse(e.data);

robot.joints.j_head_1.rotation.z = obj[0];
};


var ws41 = new WebSocket("ws://"+IP+":1882/ws/OP41");
ws41.onmessage = function(e) {

var obj = JSON.parse(e.data);

robot.joints.j_head_2.rotation.z = obj[0];
};